package com.lzw.service.impl.dormitoryAdmin;

import com.lzw.mapper.dormitoryAdmin.DormitoryAdminMapper;
import com.lzw.service.dormitoryAdmin.DormitoryAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class DormitoryAdminServiceImpl implements DormitoryAdminService {

    @Autowired
    private DormitoryAdminMapper dormitoryAdminMapper;

    @Override
    public boolean login(String username, String password) {
        return dormitoryAdminMapper.checkCredentials(username, password) != null;
    }

    @Override
    public Map<String, Object> getAdminInfo(String username, String password) {
        return dormitoryAdminMapper.getAdminInfo(username, password);
    }

    @Override
    public Map<String, Object> getAdminInfoById(Integer adminId) {
        return dormitoryAdminMapper.getAdminInfoById(adminId);
    }

    @Override
    public boolean updateAdminInfo(Integer adminId, String name, String gender, String phone, String email) {
        return dormitoryAdminMapper.updateAdminInfo(adminId, name, gender, phone, email) > 0;
    }
}